// 提交
// 引入数据库
const {
  mysqlFun
} = require('../mysql/mysql');
exports.postApi = function (app) {
  app.post("/proposal", (req, res) => {
    let sql = `INSERT INTO proposal(id,qq,text,time) value (${req.body.id},${req.body.qq},'${req.body.TextContent}',${Math.round(new Date() / 1000)})`;
    // 发送到数据库
    function obj(data) {
      // 通过长度判断是否有返回数据
      if (data === undefined) {
        return;
      }
      if (data.length !== 0) {
        res.json({
          code: 'A0001',
          msg: '意见存储成功'
        })
      }
    }
    mysqlFun(sql, obj);
  })
}